#include "ConfigTimerWork.h"
#include "DAOProxy.h"
#include "ConfigClient.h"

namespace Config
{

	ConfigTimerWork::ConfigTimerWork(ConfigSlavePrx & slaveprx,string ins ,long startInterval,long periodicInterval):_timer(startInterval,periodicInterval)
	{
		_slavePrx  = slaveprx ;
		_instanceName = ins;
	}

	void ConfigTimerWork::onTimer( Poco::Timer & timer )
	{
	    ConfigMasterPrx & master = ConfigClientObj.getMasterPrx();
		master->applySalve(_instanceName,_slavePrx);
	}

	void ConfigTimerWork::start()
	{
		_timer.start(TimerCallback<ConfigTimerWork>(*this,&ConfigTimerWork::onTimer));
	}

	void ConfigTimerWork::stop()
	{
		_timer.stop();
	}




} // namespace Config